﻿<%@ Application Language="C#"  Inherits="ADEVSO.Web.GlobalApplication"%>

<script runat="server">
    
    protected override void Application_Start(object sender, EventArgs e) 
    {
        // Code that runs on application startup
        base.Application_Start(sender, e);

        // Create reservations collection
        SmartParking.Bussiness.ReservationsManager.GetLiveReservations(Application);
    }

    protected override void Application_End(object sender, EventArgs e)
    {
        //  Code that runs on application shutdown
        base.Application_End(sender, e);

        // Remove reservations collection
        SmartParking.Bussiness.ReservationsManager.RemoveLiveReservations(Application);
    }
        
    //void Application_Error(object sender, EventArgs e) 
    //{ 
    //    // Code that runs when an unhandled error occurs

    //}

    protected override void Session_Start(object sender, EventArgs e)
    {
        // Code that runs when a new session is started
        base.Session_Start(sender, e);

        // Refresh roles
        //SmartParking.BLL.Roles.RefreshRoles(Session, Profile.UserName, Request.UserHostAddress, Profile.ManagerID);
    }

    protected override void Session_End(object sender, EventArgs e)
    {
        // Code that runs when a session ends. 
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc in the Web.config file. If session mode is set to StateServer 
        // or SQLServer, the event is not raised.
        base.Session_End(sender, e);
        
        // Remove current session from reservations collection
        SmartParking.Bussiness.ReservationsManager.RemoveLiveReservations(Application, Session);
    }
       
</script>
